package com.classicmodels.controller;

import com.classicmodels.model.Customer;
import com.classicmodels.model.CustomerDAO;
import com.classicmodels.view.CustomersList;
import java.sql.Connection;
import java.util.logging.Level;
import java.util.logging.Logger;
    

public class CustomerController {

   CustomerController(Connection c) {
        try {
            c=com.classicmodels.model.Datasource.conectarBaseDeDatos();
        } catch (Exception ex) {
            Logger.getLogger(CustomerController.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

 /*
private Connection connection;
    public CustomerController (Connection c){
       connection = c;
    }
    */
    public void show_customers() throws Exception{
        Customer[] customers= CustomerDAO.all();
        
        /*
        for (Customer c: customers){
            System.out.println(c.getCustomerName());
        }*/
       
        
        CustomersList customerlist=new CustomersList(customers);
        customerlist.setVisible(true);

    }
    

}
